;(defvar LanguagePath "/workspace/my-lib/lisp/lang/")
;(setq LanguagePath "/workspace/my-lib/lisp/lang/")
(setq LanguagePath "d:/workspace/c/my-lib/lisp/lang/")
(defun search-replace(searchString targetString)
  (save-excursion  
  (while (re-search-forward searchString)
    (replace-match targetString)
    ))
  )

(defun function-call(functionname &optional args0 args1 args2 args3 args4)
  (setq current-buffer-name (buffer-name))
  (setq name functionname)
  (save-excursion
    (switch-to-buffer "*temp*")
    (erase-buffer)
    (setq currentPoint (point))
    (insert-file (concat LanguagePath name))
    (if args0
        (search-replace (concat "<<" name ">>") args0)
    )
    
    (if args1
        (progn
          (goto-char currentPoint)          
          (search-replace (concat "<<" name "1>>") args1)
        )
    )
    (if args2
        (progn
          (goto-char currentPoint)          
          (search-replace (concat "<<" name "2>>") args2)
          )
    )
    (if args3
        (progn
          (goto-char currentPoint)          
          (search-replace (concat "<<" name "3>>") args3)
          )
    )
    (if args4
        (progn
          (goto-char currentPoint)          
          (search-replace (concat "<<" name "4>>") args4)
          )
    )
    )
  (switch-to-buffer current-buffer-name)    
  (switch-to-buffer-other-window "*temp*")
  )

(defun bash-insert-for(&optional args)
  (interactive)
  (function-call "bash-insert-for.sh" args)
  )


;(bash-insert-for "`find . -name *.c`")
;(bash-insert-for "*")
;;; insert an objective-c class 
(defun oc-class(&optional args)
  (interactive)
  (function-call "oc-class.m" args)
  )
;(oc-class "MainView")

;;; rotate objective-c class ui
(defun oc-ui-rotate()
  (interactive)
  (function-call "oc-ui-rotate.m")
  )
;(oc-ui-rotate)

(defun cs-where()
  (interactive)
  (function-call "windows/cs-where.cs")
  )
;;;
;;; sql server convert string to datatime
(defun sqlserver-convert-string-to-datetime()
  (interactive)
  (function-call "sql/convert.sql")
  )
;;;
;;; query sql server table by sql 
(defun sqlserver-table-description()
  (interactive)
  (function-call "sql/table-description.sql")
  )


